from typing import Optional
from pydantic import BaseModel, UUID4, Field
from datetime import datetime
from app.schemas.archivable import Archivable

# 个性化词汇基础模型
class PersonalizedVocabularyBase(BaseModel):
    category_name: Optional[str] =  Field(description="个性化词库分类名")
    content: Optional[str]  = Field(description="内容")

# 用于通过API创建个性化词汇时的数据模式
class PersonalizedVocabularyCreate(PersonalizedVocabularyBase):
    category_name: str
    content: str

# 用于通过API更新个性化词汇时的数据模式
class PersonalizedVocabularyUpdate(PersonalizedVocabularyBase):
    pass

# 用于在数据库中定义个性化词汇的基本模型
class PersonalizedVocabularyInDBBase(PersonalizedVocabularyBase, Archivable):
    id: UUID4
    created_at: datetime
    updated_at: Optional[datetime] = None
    archived_at: Optional[datetime] = None

    # class Config:
    #     from_attributes = True
    #     protected_namespaces = ()
        # allow_population_by_field_name = True

# 用于接收通过API返回的个性化词汇数据
class PersonalizedVocabulary(PersonalizedVocabularyInDBBase):
    pass

# 用于在数据库中存储个性化词汇数据
class PersonalizedVocabularyInDB(PersonalizedVocabularyInDBBase):
    user_id: Optional[UUID4]
